﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TheMovieDB;

namespace tmdbClient
{
    public partial class ResultSelectForm : Form
    {
        public event EventHandler MovieSelected;
        MultiMovie results;
 
        public ResultSelectForm(MultiMovie results)
        {
            InitializeComponent();

            this.results = results;

            foreach (TmdbMovie movie in this.results.results)
            {
                this.lstMovies.Items.Add(movie.Name);
            }

        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.MovieSelected != null)
            {
                this.results.selected = this.lstMovies.SelectedIndex;
                this.MovieSelected(this.results, new EventArgs());
            }
            this.Close();
        }
    }
}
